﻿#region Copyright
/* © 2008 George Tsiokos, licensed under the Microsoft Reciprocal License (Ms-RL) */
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Web;

namespace Comet.Web {
    internal sealed class CometAsyncResult : IAsyncResult {

		#region Fields (4) 

        private readonly object _asyncState;
        private readonly WaitHandle _asyncWaitHandle;
        private readonly HttpContext _httpContext;
        private bool _isCompleted;

		#endregion Fields 

		#region Constructors (1) 

        public CometAsyncResult (HttpContext httpContext, object asyncState, WaitHandle asyncWaitHandle) {
            _httpContext = httpContext;
            _asyncState = asyncState;
            _asyncWaitHandle = asyncWaitHandle;
        }

		#endregion Constructors 

		#region Properties (5) 

        public object AsyncState {
            get {
                return _asyncState;
            }
        }

        public WaitHandle AsyncWaitHandle {
            get {
                return _asyncWaitHandle;
            }
        }

        public bool CompletedSynchronously {
            get {
                return false;
            }
        }

        public HttpContext HttpContext {
            get {
                return _httpContext;
            }
        }

        public bool IsCompleted {
            get {
                return _isCompleted;
            }
        }

		#endregion Properties 

		#region Methods (1) 


		// Internal Methods (1) 

        internal void Completed () {
            _isCompleted = true;
        }


		#endregion Methods 

    }
}